package com.gxa.controller.basic_commodity_settings;

import com.gxa.common.Constants;
import com.gxa.common.PaginationResult;
import com.gxa.common.ResponseData;
import com.gxa.pojo.*;
import com.gxa.service.FinenessService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * Created with IntelliJ IDEA.
 * User: zxy
 * Date: 2020/10/27 19:04
 * Description:商品基本资料设置
 * Version: V1.0
 */
@RestController
@RequestMapping("commodity")
@Api(value = "商品基本资料设置",tags = "商品基本资料设置")
public class CbisController {

    @Autowired
    private FinenessService finenessService;
    @Autowired
    private ResponseData responseData;
    /**
     * 价格类型
     * @return
     */
    @GetMapping(value = "/queryGoldPrice")
    @ApiOperation(value = "查询价格类型",notes = "查询对应的价格类型信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryGoldPrice(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = finenessService.queryGoldPrice(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }else{
            responseData.setCode(Constants.NOTFOUND);
            responseData.setMsg("没有找到相关的信息");
        }
        return responseData;
    }

    @PostMapping(value = "/updateGoldPrice")
    @ApiOperation(value = "修改价格类型",notes = "根据返回的值修改对应的价格类型信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateGoldPrice(@RequestBody @ApiParam(name = "goldPrice",value = "价格类型") GoldPrice goldPrice){
        int result = finenessService.updateGoldPrice(goldPrice);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(goldPrice);
        }
        return responseData;
    }

    @PostMapping(value = "/delGoldPrice")
    @ApiOperation(value = "删除价格类型",notes = "根据页面返回的值删除对应的价格类型信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delGoldPrice(@RequestBody @ApiParam(name = "priceId",value = "价格类型id") GoldPrice goldPrice){
        int result = finenessService.delGoldPrice(goldPrice.getPriceId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }
        return responseData;
    }

    @PostMapping(value = "/addGoldPrice")
    @ApiOperation(value = "添加价格类型",notes = "根据页面返回的值添加对应的价格类型信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addGoldPrice(@RequestBody @ApiParam(name = "goldPrice",value = "价格类型") GoldPrice goldPrice){
        int result = finenessService.addGoldPrice(goldPrice);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(goldPrice);
        }
        return responseData;
    }

    /**
     * 重量单位设置
     * @return
     */
    @GetMapping(value = "/queryWeightUnit")
    @ApiOperation(value = "查询重量单位设置",notes = "查询对应的重量单位设置信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryWeightUnit(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = finenessService.queryWeightUnit(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }
        return responseData;
    }

    @PostMapping(value = "/updateWeightUnit")
    @ApiOperation(value = "修改重量单位设置",notes = "根据返回的值修改对应的重量单位设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateWeightUnit(@RequestBody @ApiParam(name = "weightUnit",value = "重量单位") WeightUnit weightUnit){
        int result = finenessService.updateWeightUnit(weightUnit);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(weightUnit);
        }
        return responseData;
    }

    @PostMapping(value = "/delWeightUnit")
    @ApiOperation(value = "删除重量单位设置",notes = "根据页面返回的值删除对应的重量单位设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delWeightUnit(@RequestBody @ApiParam(name = "weightUnitId",value = "重量单位id") WeightUnit weightUnit){
        int result = finenessService.delWeightUnit(weightUnit.getWeightUnitId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }
        return responseData;
    }

    @PostMapping(value = "/addWeightUnit")
    @ApiOperation(value = "添加重量单位设置",notes = "根据页面返回的值添加对应的重量单位设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addWeightUnit(@RequestBody @ApiParam(name = "weightUnit",value = "重量单位") WeightUnit weightUnit){
        int result = finenessService.addWeightUnit(weightUnit);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(weightUnit);
        }
        return responseData;
    }

    /**
     * 商品分类设置
     * @return
     */
    @GetMapping(value = "/queryCoditClass")
    @ApiOperation(value = "查询商品分类设置",notes = "查询对应的商品分类设置信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryCoditClass(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = finenessService.queryCoditClass(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }
        return responseData;
    }

    @PostMapping(value = "/updateCoditClass")
    @ApiOperation(value = "修改商品分类设置",notes = "根据返回的值修改对应的商品分类设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateCoditClass(@RequestBody @ApiParam(name = "coditClass",value = "商品分类") CoditClass coditClass){
        int result = finenessService.updateCoditClass(coditClass);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(coditClass);
        }
        return responseData;
    }

    @PostMapping(value = "/delCoditClass")
    @ApiOperation(value = "删除商品分类设置",notes = "根据页面返回的值删除对应的商品分类设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delCoditClass(@RequestBody @ApiParam(name = "coditClassId",value = "商品分类id") CoditClass coditClass){
        int result = finenessService.delCoditClass(coditClass.getCoditClassId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }
        return responseData;
    }

    @PostMapping(value = "/addCoditClass")
    @ApiOperation(value = "添加商品分类设置",notes = "根据页面返回的值添加对应的商品分类设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addCoditClass(@RequestBody @ApiParam(name = "coditClass",value = "商品分类") CoditClass coditClass){
        int result = finenessService.addCoditClass(coditClass);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(coditClass);
        }
        return responseData;
    }

    /**
     * 商品系列设置
     * @return
     */
    @GetMapping(value = "/queryCoditSer")
    @ApiOperation(value = "查询商品系列设置",notes = "查询对应的商品系列设置信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryCoditSer(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = finenessService.queryCoditSer(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }
        return responseData;
    }

    @PostMapping(value = "/updateCoditSer")
    @ApiOperation(value = "修改商品系列设置",notes = "根据返回的值修改对应的商品系列设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateCoditSer(@RequestBody @ApiParam(name = "coditSer",value = "商品系列设置") CoditSer coditSer){
        int result = finenessService.updateCoditSer(coditSer);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(coditSer);
        }
        return responseData;
    }

    @PostMapping(value = "/delCoditSer")
    @ApiOperation(value = "删除商品系列设置",notes = "根据页面返回的值删除对应的商品系列设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delCoditSer(@RequestBody @ApiParam(name = "coditSerId",value = "商品系列设置id") CoditSer coditSer){
        int result = finenessService.delCoditSer(coditSer.getCoditSerId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }
        return responseData;
    }

    @PostMapping(value = "/addCoditSer")
    @ApiOperation(value = "添加商品系列设置",notes = "根据页面返回的值添加对应的商品系列设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addCoditSer(@RequestBody @ApiParam(name = "coditSer",value = "商品系列设置") CoditSer coditSer){
        int result = finenessService.addCoditSer(coditSer);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(coditSer);
        }
        return responseData;
    }

    /**
     * 提成分类设置
     * @return
     */
    @GetMapping(value = "/queryCommisTyp")
    @ApiOperation(value = "查询提成分类设置",notes = "查询对应的提成分类设置信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryCommisTyp(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = finenessService.queryCommisTyp(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }
        return responseData;
    }

    @PostMapping(value = "/updateCommisTyp")
    @ApiOperation(value = "修改提成分类设置",notes = "根据返回的值修改对应的提成分类设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateCommisTyp(@RequestBody @ApiParam(name = "commisTyp",value = "提成分类设置") CommisTyp commisTyp){
        int result = finenessService.updateCommisTyp(commisTyp);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(commisTyp);
        }
        return responseData;
    }

    @PostMapping(value = "/delCommisTyp")
    @ApiOperation(value = "删除提成分类设置",notes = "根据页面返回的值删除对应的提成分类设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delCommisTyp(@RequestBody @ApiParam(name = "commisTypId",value = "提成分类设置id") CommisTyp commisTyp){
        int result = finenessService.delCommisTyp(commisTyp.getCommisTypId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }
        return responseData;
    }

    @PostMapping(value = "/addCommisTyp")
    @ApiOperation(value = "添加提成分类设置",notes = "根据页面返回的值添加对应的提成分类设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addCommisTyp(@RequestBody @ApiParam(name = "commisTyp",value = "提成分类设置") CommisTyp commisTyp){
        int result = finenessService.addCommisTyp(commisTyp);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(commisTyp);
        }
        return responseData;
    }

    /**
     * 币别设置
     * @return
     */
    @GetMapping(value = "/queryConis")
    @ApiOperation(value = "查询币别设置",notes = "查询对应的币别设置信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryConis(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = finenessService.queryConis(currentPage,pageSize);
        if(paginationResult != null){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("查询成功");
            responseData.setData(paginationResult);
        }
        return responseData;
    }

    @PostMapping(value = "/updateConis")
    @ApiOperation(value = "修改币别设置",notes = "根据返回的值修改对应的币别设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateConis(@RequestBody @ApiParam(name = "conis",value = "修改币别设置") Conis conis){
        int result = finenessService.updateConis(conis);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(conis);
        }
        return responseData;
    }

    @PostMapping(value = "/delConis")
    @ApiOperation(value = "删除币别设置",notes = "根据页面返回的值删除对应的币别设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delConis(@RequestBody @ApiParam(name = "conisId",value = "修改币别设置id") Conis conis){
        int result = finenessService.delConis(conis.getConisId());
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }
        return responseData;
    }

    @PostMapping(value = "/addConis")
    @ApiOperation(value = "添加币别设置",notes = "根据页面返回的值添加对应的币别设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addConis(@RequestBody @ApiParam(name = "conis",value = "修改币别设置") Conis conis){
        int result = finenessService.addConis(conis);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(conis);
        }
        return responseData;
    }

    /**
     * 成色设置
     * @return
     */
    @GetMapping(value = "/queryFineness")
    @ApiOperation(value = "查询成色设置",notes = "查询对应的成色设置信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryFileness(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = finenessService.queryFileness(currentPage,pageSize);
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("查询成功");
        responseData.setData(paginationResult);
        return responseData;
    }

    @PostMapping(value = "/updateFineness")
    @ApiOperation(value = "修改成色设置",notes = "根据返回的值修改对应的成色设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateFineness(@RequestBody @ApiParam(name = "fineness",value = "成色设置") Fineness fineness){
        System.out.println(fineness.getFinenessId());
        int result = finenessService.updateFineness(fineness);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(fineness);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("修改失败");
        }
        return responseData;
    }

    @PostMapping(value = "/delFineness")
    @ApiOperation(value = "删除成色设置",notes = "根据页面返回的值删除对应的成色设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delFineness(@RequestBody @ApiParam(name = "finenessId",value = "成色设置id") Fineness fineness){
        System.out.println(fineness.getFinenessId());
        int result = finenessService.delFineness(fineness);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("删除失败");
        }
        return responseData;
    }

    @PostMapping(value = "/addFineness")
    @ApiOperation(value = "添加成色设置",notes = "根据页面返回的值添加对应的成色设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addStoneHead(@RequestBody @ApiParam(name = "fineness",value = "成色设置") Fineness fineness){
        System.out.println(fineness.getFinenessId());
        int result = finenessService.addFineness(fineness);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(fineness);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("添加失败");
        }
        return responseData;
    }

    /**
     * 属性设置
     * @return
     */
    @GetMapping(value = "/queryAttribute")
    @ApiOperation(value = "查询属性设置",notes = "查询对应的属性设置信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryAttribute(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = finenessService.queryAttribute(currentPage,pageSize);
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("查询成功");
        responseData.setData(paginationResult);
        return responseData;
    }

    @PostMapping(value = "/updateAttribute")
    @ApiOperation(value = "修改属性设置",notes = "根据返回的值修改对应的属性设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateAttribute(@RequestBody @ApiParam(name = "attribute",value = "属性设置") Attribute attribute){
        System.out.println(attribute.getAttributeId());
        int result = finenessService.updateAttribute(attribute);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(attribute);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("修改失败");
        }
        return responseData;
    }

    @PostMapping(value = "/delAttribute")
    @ApiOperation(value = "删除属性设置",notes = "根据页面返回的值删除对应的属性设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delAttribute(@RequestBody @ApiParam(name = "attributeId",value = "属性设置id") Attribute attribute){
        System.out.println(attribute.getAttributeId());
        int result = finenessService.delAttribute(attribute);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("删除失败");
        }
        return responseData;
    }

    @PostMapping(value = "/addAttribute")
    @ApiOperation(value = "添加属性设置",notes = "根据页面返回的值添加对应的属性设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addAttribute(@RequestBody @ApiParam(name = "attribute",value = "属性设置") Attribute attribute){
        System.out.println(attribute.getAttributeId());
        int result = finenessService.addAttribute(attribute);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(attribute);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("添加失败");
        }
        return responseData;
    }

    /**
     * 款式分类设置
     * @return
     */
    @GetMapping(value = "/queryStyle")
    @ApiOperation(value = "查询款式分类设置",notes = "查询对应的款式分类设置信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryStyle(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = finenessService.queryStyle(currentPage,pageSize);
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("查询成功");
        responseData.setData(paginationResult);
        return responseData;
    }

    @PostMapping(value = "/updateStyle")
    @ApiOperation(value = "修改款式分类设置",notes = "根据返回的值修改对应的款式分类设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateStyle(@RequestBody @ApiParam(name = "style",value = "款式分类") Style style){
        System.out.println(style.getStyleId());
        int result = finenessService.updateStyle(style);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(style);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("修改失败");
        }
        return responseData;
    }

    @PostMapping(value = "/delStyle")
    @ApiOperation(value = "删除款式分类设置",notes = "根据页面返回的值删除对应的款式分类设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delStyle(@RequestBody @ApiParam(name = "styleId",value = "款式分类id") Style style){
        System.out.println(style.getStyleId());
        int result = finenessService.delStyle(style);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("删除失败");
        }
        return responseData;
    }

    @PostMapping(value = "/addStyle")
    @ApiOperation(value = "添加款式分类设置",notes = "根据页面返回的值添加对应的款式分类设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addStyle(@RequestBody @ApiParam(name = "style",value = "款式分类") Style style){
        System.out.println(style.getStyleId());
        int result = finenessService.addStyle(style);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(style);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("添加失败");
        }
        return responseData;
    }

    /**
     * 商品类型设置
     * @return
     */
    @GetMapping(value = "/queryCoditTyp")
    @ApiOperation(value = "查询商品类型设置",notes = "查询对应的商品类型设置信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryCoditTyp(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = finenessService.queryCoditTyp(currentPage,pageSize);
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("查询成功");
        responseData.setData(paginationResult);
        return responseData;
    }

    @PostMapping(value = "/updateCoditTyp")
    @ApiOperation(value = "修改商品类型设置",notes = "根据返回的值修改对应的商品类型设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateCoditTyp(@RequestBody @ApiParam(name = "coditTyp",value = "商品类型") CoditTyp coditTyp){
        System.out.println(coditTyp.getCoditTypId());
        int result = finenessService.updateCoditTyp(coditTyp);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(coditTyp);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("修改失败");
        }
        return responseData;
    }

    @PostMapping(value = "/delCoditTyp")
    @ApiOperation(value = "删除商品类型设置",notes = "根据页面返回的值删除对应的商品类型设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delCoditTyp(@RequestBody @ApiParam(name = "coditTypId",value = "商品类型id") CoditTyp coditTyp){
        System.out.println(coditTyp.getCoditTypId());
        int result = finenessService.delCoditTyp(coditTyp);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("删除失败");
        }
        return responseData;
    }

    @PostMapping(value = "/addCoditTyp")
    @ApiOperation(value = "添加商品类型设置",notes = "根据页面返回的值添加对应的款式商品类型信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addCoditTyp(@RequestBody @ApiParam(name = "coditTyp",value = "商品类型") CoditTyp coditTyp){
        System.out.println(coditTyp.getCoditTypId());
        int result = finenessService.addCoditTyp(coditTyp);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(coditTyp);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("添加失败");
        }
        return responseData;
    }

    /**
     * 含金量设置
     * @return
     */
    @GetMapping(value = "/queryGoldCont")
    @ApiOperation(value = "查询含金量设置",notes = "查询对应的含金量设置信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryGoldCont(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = finenessService.queryGoldCont(currentPage,pageSize);
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("查询成功");
        responseData.setData(paginationResult);
        return responseData;
    }

    @PostMapping(value = "/updateGoldCont")
    @ApiOperation(value = "修改含金量设置",notes = "根据返回的值修改对应的含金量设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateGoldCont(@RequestBody @ApiParam(name = "goldCont",value = "含金量") GoldCont goldCont){
        System.out.println(goldCont.getGoldId());
        int result = finenessService.updateGoldCont(goldCont);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(goldCont);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("修改失败");
        }
        return responseData;
    }

    @PostMapping(value = "/delGoldCont")
    @ApiOperation(value = "删除含金量设置",notes = "根据页面返回的值删除对应的含金量设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delGoldCont(@RequestBody @ApiParam(name = "goldId",value = "含金量id") GoldCont goldCont){
        System.out.println(goldCont.getGoldId());
        int result = finenessService.delGoldCont(goldCont);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("删除失败");
        }
        return responseData;
    }

    @PostMapping(value = "/addGoldCont")
    @ApiOperation(value = "添加含金量设置",notes = "根据页面返回的值添加对应的款式含金量信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addGoldCont(@RequestBody @ApiParam(name = "goldCont",value = "含金量") GoldCont goldCont){
        System.out.println(goldCont.getGoldId());
        int result = finenessService.addGoldCont(goldCont);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(goldCont);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("添加失败");
        }
        return responseData;
    }

    /**
     * 旧料设置
     * @return
     */
    @GetMapping(value = "/queryRecovery")
    @ApiOperation(value = "查询旧料设置",notes = "查询对应的旧料设置信息",httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData queryRecovery(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "3")int pageSize){
        PaginationResult paginationResult = finenessService.queryRecovery(currentPage,pageSize);
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("查询成功");
        responseData.setData(paginationResult);
        return responseData;
    }

    @PostMapping(value = "/updateRecovery")
    @ApiOperation(value = "修改旧料设置",notes = "根据返回的值修改对应的旧料设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="修改成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData updateRecovery(@RequestBody @ApiParam(name = "recovery",value = "旧料设置") Recovery recovery){
        System.out.println(recovery.getRecoveryId());
        int result = finenessService.updateRecovery(recovery);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("修改成功");
            responseData.setData(recovery);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("修改失败");
        }
        return responseData;
    }

    @PostMapping(value = "/delRecovery")
    @ApiOperation(value = "删除旧料设置",notes = "根据页面返回的值删除对应的旧料设置信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData delRecovery(@RequestBody @ApiParam(name = "recoveryId",value = "旧料设置id") Recovery recovery){
        System.out.println(recovery.getRecoveryId());
        int result = finenessService.delRecovery(recovery);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("删除成功");
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("删除失败");
        }
        return responseData;
    }

    @PostMapping(value = "/addRecovery")
    @ApiOperation(value = "添加旧料设置",notes = "根据页面返回的值添加对应的款式旧料信息",httpMethod = "Post", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public ResponseData addRecovery(@RequestBody @ApiParam(name = "recovery",value = "旧料设置") Recovery recovery){
        System.out.println(recovery.getRecoveryId());
        int result = finenessService.addRecovery(recovery);
        if(result > 0){
            responseData.setCode(Constants.SUCCESS);
            responseData.setMsg("添加成功");
            responseData.setData(recovery);
        }else{
            responseData.setCode(Constants.FAILED);
            responseData.setMsg("添加失败");
        }
        return responseData;
    }
}
